load(
    "//bazel:tachyon_cc.bzl",
    "tachyon_cc_library",
    "tachyon_cc_unittest",
)

package(default_visibility = ["//visibility:public"])

tachyon_cc_library(
    name = "gwc",
    hdrs = ["gwc.h"],
    deps = [
        ":kzg_family",
        "//tachyon/crypto/commitments:polynomial_openings",
        "//tachyon/crypto/commitments:univariate_polynomial_commitment_scheme",
        "//tachyon/crypto/transcripts:transcript",
        "//tachyon/math/elliptic_curves/pairing",
        "@com_google_googletest//:gtest_prod",
    ],
)

tachyon_cc_library(
    name = "kzg",
    hdrs = ["kzg.h"],
    deps = [
        "//tachyon/base:logging",
        "//tachyon/base/buffer:copyable",
        "//tachyon/base/containers:container_util",
        "//tachyon/crypto/commitments:batch_commitment_state",
        "//tachyon/device/gpu:gpu_memory",
        "//tachyon/device/gpu:scoped_mem_pool",
        "//tachyon/device/gpu:scoped_stream",
        "//tachyon/math/elliptic_curves/msm:variable_base_msm",
        "//tachyon/math/elliptic_curves/msm:variable_base_msm_gpu",
        "//tachyon/math/polynomials/univariate:univariate_evaluation_domain",
    ],
)

tachyon_cc_library(
    name = "kzg_family",
    hdrs = ["kzg_family.h"],
    deps = [":kzg"],
)

tachyon_cc_library(
    name = "kzg_family_test",
    testonly = True,
    hdrs = ["kzg_family_test.h"],
    deps = [
        ":kzg",
        "//tachyon/base/buffer",
        "//tachyon/base/json",
        "//tachyon/crypto/commitments/test:bn254_kzg_polynomial_openings",
        "//tachyon/crypto/transcripts:simple_transcript",
        "//tachyon/math/elliptic_curves/bn/bn254",
        "//tachyon/math/elliptic_curves/bn/bn254:g1",
        "//tachyon/math/polynomials/univariate:univariate_evaluation_domain_factory",
    ],
)

tachyon_cc_library(
    name = "shplonk",
    hdrs = ["shplonk.h"],
    deps = [
        ":kzg_family",
        "//tachyon/base/containers:contains",
        "//tachyon/crypto/commitments:polynomial_openings",
        "//tachyon/crypto/commitments:univariate_polynomial_commitment_scheme",
        "//tachyon/crypto/transcripts:transcript",
        "//tachyon/math/elliptic_curves/pairing",
        "@com_google_googletest//:gtest_prod",
    ],
)

tachyon_cc_unittest(
    name = "kzg_unittests",
    srcs = [
        "gwc_unittest.cc",
        "kzg_unittest.cc",
        "shplonk_unittest.cc",
    ],
    deps = [
        ":gwc",
        ":kzg_family_test",
        ":shplonk",
    ],
)
